package com.fizz.redpacket.lock;


 import com.fizz.redpacket.lock.RejectPolicyFactory;
/*    */ import java.util.concurrent.TimeUnit;
/*    */ import java.util.concurrent.locks.Condition;
/*    */ import java.util.concurrent.locks.Lock;
/*    */ import org.springframework.data.redis.core.RedisTemplate;
 public abstract class RedisLock implements Lock
 {
   protected RedisTemplate<String, Object> template;
   protected RejectPolicyFactory rejectPolicyFactory;
   protected long expired;

   protected RedisLock() {}

   public RedisLock(RedisTemplate<String, Object> template, long expired) {
     this.template = template;
     this.expired = expired;
     this.rejectPolicyFactory = new RejectPolicyFactory();
   }

   protected RedisLock(RedisTemplate<String, Object> template, RejectPolicyFactory factory, long expired) {
     if (template == null) {
       throw new IllegalArgumentException();
     }

     this.template = template;
     this.rejectPolicyFactory = factory;
     this.expired = expired;
   }

   public abstract void lock();

   public abstract boolean tryLock();

   public abstract boolean tryLock(long paramLong, TimeUnit paramTimeUnit) throws InterruptedException;

   public abstract void unlock();

   public Condition newCondition() {
     throw new UnsupportedOperationException();
   }

   public void lockInterruptibly() throws InterruptedException {
     throw new UnsupportedOperationException();
   }
 }
